<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>xialksje</title>
</head>
<body>
<input type="button" value="随机" id="btn"></br>
<select name="hero" id="list">
    <option>你</option>
    <option>是</option>
    <option>猪</option>
    <option>我</option>
    <option>爱</option>
    <option>吃</option>
    <script>
        var btn=document.getElementById("btn");
        var list=document.getElementById("list");
        var options=list.getElementsByTagName("option");
        btn.onclick=function(){
            //生成随机索引
            var sjsy=Math.floor(Math.random()*options.length);
            options[sjsy].selected=true;
        }
    </script>
</select>

</body>
</html>